﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using QuanLyBanHang_NewApp.BUS;

namespace QuanLyBanHang_NewApp
{
    public partial class FormLapBaoCao : Form
    {
        HoaDonBUS hdbus = new HoaDonBUS();
        public FormLapBaoCao()
        {
            InitializeComponent();
            cbLoaiBC.Text = "Báo cáo doanh thu";
        }

        private void btn_XacNhan_Click(object sender, EventArgs e)
        {
            int thang = Convert.ToInt32(cbThang.Text.Trim());
            int nam = Convert.ToInt32(txtNam.Text.Trim());
            int id;
            if (cbLoaiBC.Text.CompareTo("Báo cáo doanh thu") == 0)
            {
                id = 0;
            }
            else
            {
                if (cbLoaiBC.Text.CompareTo("Báo cáo hóa đơn") == 0)
                {
                    id = 1;
                }
                else { id = 2; }
            }
            DataTable dt = hdbus.getReport(id, thang, nam);
            dataGridView1.DataSource = dt;
        }

        private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {

        }

        private void txtNam_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (!Char.IsControl(e.KeyChar) && !Char.IsDigit(e.KeyChar))
            {
                e.Handled = true;
            }
        }
    }
}
